<!-- $Id: goods_info.htm 17126 2010-04-23 10:30:26Z liuhui $ -->
{include file="pageheader2.htm"}
{insert_scripts files="../js/utils.js,selectzone2.js,colorselector.js"}
<script type="text/javascript" src="../js/calendar.php?lang={$cfg_lang}"></script>
<script type="text/javascript" src="http://public.eggms.com/js/jquery.js"></script>
<script type="text/javascript" src="http://public.eggms.com/js/jquery.json.js"></script>
<link href="../js/calendar/calendar.css" rel="stylesheet" type="text/css" />

{if $warning}
<ul style="padding:0; margin: 0; list-style-type:none; color: #CC0000;">
  <li style="border: 1px solid #CC0000; background: #FFFFCC; padding: 10px; margin-bottom: 5px;" >{$warning}</li>
</ul>
{/if}

<!-- start goods form -->
<div class="tab-div">
    <!-- tab bar -->
    <div id="tabbar-div">
      <p>
        <span class="tab-front" id="general-tab">{$lang.tab_general}</span>
        <span class="tab-back" id="detail-tab">{$lang.tab_detail}</span>
        <span class="tab-back" id="mix-tab">{$lang.tab_mix}</span>
        {if $goods_type_list}<span class="tab-back" id="properties-tab">{$lang.tab_properties}</span>{/if}
        <span class="tab-back" id="gallery-tab">{$lang.tab_gallery}</span>
        <span class="tab-back" id="linkgoods-tab">{$lang.tab_linkgoods}</span>
        {if $code eq ''}<span class="tab-back" id="groupgoods-tab">{$lang.tab_groupgoods}</span>{/if}
        <span class="tab-back" id="serviceprice-tab">服务区库存</span>
      </p>
    </div>

    <!-- tab body -->
    <div id="tabbody-div" >
      <form enctype="multipart/form-data" action="" method="post" name="theForm" >
        <!-- 鏈€澶ф枃浠堕檺鍒 -->
        <input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
        <!-- 閫氱敤淇℃伅 -->
        <table width="90%" id="general-table" align="center" >
          <!-- 商品名称 -->
          <tr>
            <td class="label">{$lang.lab_goods_name}</td>
            <td><input type="text" name="goods_name" value="{$goods.goods_name|escape}" style="float:left;color:{$goods_name_color};" size="30" />
            {$lang.require_field}</td>
          </tr>
          <!-- 商品名称end -->
          <!-- 是否为淘蛋商品 -->
          <tr>
            <td class="label"><input type="checkbox" name="is_taodan" value="1" {if $goods.is_taodan}checked="checked"{/if}>淘蛋商品</td>
            <td><input type="radio" name="is_taobao" value="1" {if $goods.is_taobao eq 1}checked="checked"{/if}>淘宝商品  <input type="radio" name="is_taobao" value="2" {if $goods.is_taobao eq 2}checked="checked"{/if}>天猫商品  <input type="radio" name="is_taobao" value="0" {if $goods.is_taobao eq 0}checked="checked"{/if}>其它商品</td>
          </tr>
          <tr>
            <td class="label">跳转外部链接</td>
            <td><input type="text" name="get_url" value="{$goods.get_url}" size="30">跳转外部链接</td>
          </tr>
          <!-- 是否为淘蛋商品end -->
          <!-- 商品编号 -->
          <tr>
            <td class="label">
            <a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a> 商品编号： </td>
            <td><input type="text" name="goods_sku" value="{$goods.goods_sku}" size="20" onblur="checkGoodsSku(this.value,'{$goods.goods_id}')" /><span id="goods_sku_notice"></span><br />
            <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">如果您不输入商品编号，系统将自动生成一个唯一的编号。</span></td>
          </tr>
          <!-- 商品编号end -->
          <tr>
            <td class="label">
            条形码类型: </td>
            <td>
              <select size="1" id="codeType" name="codeType">
                <option value="BCGcodabar">Codabar</option>
                <option value="BCGcode11">Code 11</option>
                <option value="BCGcode39">Code 39</option>
                <option value="BCGcode39extended">Code 39 Extended</option>
                <option value="BCGcode93">Code 93</option>
                <option value="BCGcode128">Code 128</option>
                <option value="BCGean8">EAN-8</option>
                <option value="BCGean13" selected="selected">EAN-13</option>
                <option value="BCGgs1128">GS1-128 (EAN-128)</option>
                <option value="BCGisbn">ISBN</option>
                <option value="BCGi25">Interleaved 2 of 5</option>
                <option value="BCGs25">Standard 2 of 5</option>
                <option value="BCGmsi">MSI Plessey</option>
                <option value="BCGupca">UPC-A</option>
                <option value="BCGupce">UPC-E</option>
                <option value="BCGupcext2">UPC Extenstion 2 Digits</option>
                <option value="BCGupcext5">UPC Extenstion 5 Digits</option>
                <option value="BCGpostnet">Postnet</option>
                <option value="BCGintelligentmail">Intelligent Mail</option>
                <option value="BCGothercode">Other Barcode</option></select>
            </td>
          </tr>
            <tr>
            <td class="label">
            <a href="javascript:showNotice('noticeGoodsSN');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a> 产品条形码： </td>
            <td>{if $form_act eq 'insert'}<input type="text" name="sku" value="{$goods.sku|escape}" size="20" onblur="checkGoodsCode(this.value)" /><span id="goods_code_notice"></span>{else}{$goods.sku|escape}{/if}<br />
            <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsSN">如果您不输入条形码，系统将自动生成一个唯一的条形码。并不可作修改</span></td>
          </tr>
          <!-- 商品分类 -->
          <tr>
            <td class="label">{$lang.lab_goods_cat}</td>
            <td><select name="cat_id" onchange="hideCatDiv()" ><option value="0">{$lang.select_please}</option>{$cat_list}</select>
              {if $is_add}
              <a href="javascript:void(0)" onclick="rapidCatAdd()" title="{$lang.rapid_add_cat}" class="special">{$lang.rapid_add_cat}</a>
              <span id="category_add" style="display:none;">
              <input class="text" size="10" name="addedCategoryName" />
               <a href="javascript:void(0)" onclick="addCategory()" title="{$lang.button_submit}" class="special" >{$lang.button_submit}</a>
               <a href="javascript:void(0)" onclick="return goCatPage()" title="{$lang.category_manage}" class="special" >{$lang.category_manage}</a>
               <a href="javascript:void(0)" onclick="hideCatDiv()" title="{$lang.hide}" class="special" > << </a>
               </span>
               {/if}
               {$lang.require_field}
            </td>
          </tr>
          <!-- 商品分类end -->
          <!-- 扩展分类 -->
          <tr>
            <td class="label">{$lang.lab_other_cat}</td>
            <td>
              <input type="button" value="{$lang.add}" onclick="addOtherCat(this.parentNode)" class="button" />
              {foreach from=$goods.other_cat item=cat_id}
              <select name="other_cat[]"><option value="0">{$lang.select_please}</option>{$other_cat_list.$cat_id}</select>
              {/foreach}
            </td>
          </tr>
          <!-- 扩展分类end -->
          <!-- 商品品牌 -->
          <tr>
            <td class="label">{$lang.lab_goods_brand}</td>
            <td><select name="brand_id" onchange="hideBrandDiv()" ><option value="0">{$lang.select_please}{html_options options=$brand_list selected=$goods.brand_id}</option></select>
              {if $is_add}
              <a href="javascript:void(0)" title="{$lang.rapid_add_brand}" onclick="rapidBrandAdd()" class="special" >{$lang.rapid_add_brand}</a>
              <span id="brand_add" style="display:none;">
              <input class="text" size="15" name="addedBrandName" />
               <a href="javascript:void(0)" onclick="addBrand()" class="special" >{$lang.button_submit}</a>
               <a href="javascript:void(0)" onclick="return goBrandPage()" title="{$lang.brand_manage}" class="special" >{$lang.brand_manage}</a>
               <a href="javascript:void(0)" onclick="hideBrandDiv()" title="{$lang.hide}" class="special" > << </a>
               </span>
               {/if}
            </td>
          </tr>
          <!-- 商品品牌end -->
          <!-- 市场售价 -->
          <tr>
            <td class="label">{$lang.lab_market_price}</td>
            <td><input type="text" name="market_price" value="{$goods.market_price}" size="20" />
              <input type="button" value="{$lang.integral_market_price}" onclick="integral_market_price()" />
            </td>
          </tr>
          <!-- 市场售价end -->
          <!-- 商品售价 -->
          <tr>
            <td class="label">{$lang.lab_shop_price}</td>
            <td><input type="text" name="shop_price" value="{$goods.shop_price}" size="20" onblur="priceSetted()"/>
            <input type="button" value="{$lang.compute_by_mp}" onclick="marketPriceSetted()" />
            {$lang.require_field}</td>
          </tr>
          <!-- 商品售价end -->
          <!-- 梯度2价格 -->
          <tr>
              <td class="label">梯度2价格：</td>
              <td><input type="text" name="preferential_price2" value="{$goods.preferential_price2}" size="20" />
              </td>
          </tr>
          <!-- 梯度2价格end -->
          <!-- 梯度5价格 -->
          <tr>
              <td class="label">梯度5价格：</td>
              <td><input type="text" name="preferential_price5" value="{$goods.preferential_price5}" size="20" />
              </td>
          </tr>
          <!-- 梯度5价格end -->
          <!-- 优惠数量 -->
          <tr>
              <td class="label">优惠数量：</td>
              <td><input type="text" name="preferential_num" value="{$goods.preferential_num}" size="20"/>
              </td>
          </tr>
          <!-- 优惠数量end -->
          <!-- 优惠价格 -->
          <tr>
              <td class="label">优惠价格：</td>
              <td><input type="text" name="preferential_price" value="{$goods.preferential_price}" size="20" />
              </td>
          </tr>
          <!-- 优惠价格end -->

          <!-- 赠送消费积分数 -->
          <tr>
            <td class="label"><a href="javascript:showNotice('giveIntegral');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a> {$lang.lab_give_integral}</td>
            <td><input type="text" name="give_integral" value="{$goods.give_integral}" size="20" />
            <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="giveIntegral">{$lang.notice_give_integral}</span></td>
          </tr>
          <!-- 赠送消费积分数end -->
          <!-- 赠送等级积分数 -->
          <tr>
            <td class="label"><a href="javascript:showNotice('rankIntegral');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a> {$lang.lab_rank_integral}</td>
            <td><input type="text" name="rank_integral" value="{$goods.rank_integral}" size="20" />
            <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="rankIntegral">{$lang.notice_rank_integral}</span></td>
          </tr>
          <!-- 赠送等级积分数end -->
          <!-- 积分购买金额 -->
          <tr>
            <td class="label"><a href="javascript:showNotice('noticPoints');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a> {$lang.lab_integral}</td>
            <td><input type="text" name="integral" value="{$goods.integral}" size="20" onblur="parseint_integral()";/>
              <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticPoints">{$lang.notice_integral}</span>
            </td>
          </tr>
          <!-- 积分购买金额end -->
          <!-- 促销价 -->
          <tr>
            <td class="label"><label for="is_promote"><input type="checkbox" id="is_promote" name="is_promote" value="1" {if $goods.is_promote}checked="checked"{/if} onclick="handlePromote(this.checked);" /> {$lang.lab_promote_price}</label></td>
            <td id="promote_3"><input type="text" id="promote_1" name="promote_price" value="{$goods.promote_price}" size="20" /></td>
          </tr>
          <!-- 促销价end -->
          <!-- 促销日期 -->
          <tr id="promote_4">
            <td class="label" id="promote_5">{$lang.lab_promote_date}</td>
            <td id="promote_6">
              <input name="promote_start_date" type="text" id="promote_start_date" size="22" value='{$goods.promote_start_date}' readonly="readonly" /><input name="selbtn1" type="button" id="selbtn1" onclick="return showCalendar('promote_start_date', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_select}" class="button"/> - <input name="promote_end_date" type="text" id="promote_end_date" size="22" value='{$goods.promote_end_date}' readonly="readonly" /><input name="selbtn2" type="button" id="selbtn2" onclick="return showCalendar('promote_end_date', '%Y-%m-%d %H:%M', '24', false, 'selbtn1');" value="{$lang.btn_select}" class="button"/>
            </td>
          </tr>
          <!-- 促销日期end -->
          <!-- 上传商品图片 -->
          <tr>
            <td class="label">{$lang.lab_picture}</td>
            <td>
              <input type="file" name="goods_img" size="35" />
              {if $goods.goods_img}
                <a href="goods.php?act=show_image&img_url={$goods.goods_img}" target="_blank"><img src="images/yes.gif" border="0" /></a>
              {else}
                <img src="images/no.gif" />
              {/if}
              <br /><input type="text" size="40" value="{$lang.lab_picture_url}" style="color:#aaa;" onfocus="if (this.value == '{$lang.lab_picture_url}'){this.value='http://';this.style.color='#000';}" name="goods_img_url"/>
            </td>
          </tr>
          <!-- 上传商品图片end -->
          <!-- 上传商品缩略图 -->
          <tr id="auto_thumb_1">
            <td class="label"> {$lang.lab_thumb}</td>
            <td id="auto_thumb_3">
              <input type="file" name="goods_thumb" size="35" />
              {if $goods.goods_thumb}
                <a href="goods.php?act=show_image&img_url={$goods.goods_thumb}" target="_blank"><img src="images/yes.gif" border="0" /></a>
              {else}
                <img src="images/no.gif" />
              {/if}
              <br /><input type="text" size="40" value="{$lang.lab_thumb_url}" style="color:#aaa;" onfocus="if (this.value == '{$lang.lab_thumb_url}'){this.value='http://';this.style.color='#000';}" name="goods_thumb_url"/>
              {if $gd > 0}
              <br /><label for="auto_thumb"><input type="checkbox" id="auto_thumb" name="auto_thumb" checked="true" value="1" onclick="handleAutoThumb(this.checked)" />{$lang.auto_thumb}</label>{/if}
            </td>
          </tr>
          <!-- 上传商品缩略图end -->
        </table>

        <!-- 详细描述 -->
        <table width="90%" id="detail-table" style="display:none">
          <tr>
            <td>
              {if $smarty.get.old}{$FCKeditor}
              {else}
              <script type="text/javascript" charset="utf-8" src="/includes/ueditor/ueditor.config.js"></script>
              <script type="text/javascript" charset="utf-8" src="/includes/ueditor/ueditor.all.min.js"> </script>
              <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
              <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
              <script type="text/javascript" charset="utf-8" src="/includes/ueditor/lang/zh-cn/zh-cn.js"></script>

              <script id="editor" type="text/plain" style="width:1024px;height:500px;">{$goods.goods_desc}</script>
              <script type="text/javascript">
                  window.__Object_toJSONString = Object.prototype.toJSONString;
                  delete(Object.prototype.toJSONString);
                  //实例化编辑器
                  //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
                  window.UEDITOR_CONFIG.serverUrl = "/includes/ueditor/php/controller.php?goods_sku={$goods.goods_sku}&set_url={$smarty.get.set_url}";
                  var ue = UE.getEditor('editor');
                  function isFocus(e){
                      alert(UE.getEditor('editor').isFocus());
                      UE.dom.domUtils.preventDefault(e)
                  }
                  function setblur(e){
                      UE.getEditor('editor').blur();
                      UE.dom.domUtils.preventDefault(e)
                  }
                  function insertHtml() {
                      var value = prompt('插入html代码', '');
                      UE.getEditor('editor').execCommand('insertHtml', value)
                  }
                  function createEditor() {
                      enableBtn();
                      UE.getEditor('editor');
                  }
                  function getAllHtml() {
                      alert(UE.getEditor('editor').getAllHtml())
                  }
                  function getContent() {
                      var arr = [];
                      arr.push("使用editor.getContent()方法可以获得编辑器的内容");
                      arr.push("内容为：");
                      arr.push(UE.getEditor('editor').getContent());
                      alert(arr.join("\n"));
                  }
                  function getPlainTxt() {
                      var arr = [];
                      arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
                      arr.push("内容为：");
                      arr.push(UE.getEditor('editor').getPlainTxt());
                      alert(arr.join('\n'))
                  }
                  function setContent(isAppendTo) {
                      var arr = [];
                      arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
                      UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
                      alert(arr.join("\n"));
                  }
                  function setDisabled() {
                      UE.getEditor('editor').setDisabled('fullscreen');
                      disableBtn("enable");
                  }

                  function setEnabled() {
                      UE.getEditor('editor').setEnabled();
                      enableBtn();
                  }

                  function getText() {
                      //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
                      var range = UE.getEditor('editor').selection.getRange();
                      range.select();
                      var txt = UE.getEditor('editor').selection.getText();
                      alert(txt)
                  }

                  function getContentTxt() {
                      var arr = [];
                      arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
                      arr.push("编辑器的纯文本内容为：");
                      arr.push(UE.getEditor('editor').getContentTxt());
                      alert(arr.join("\n"));
                  }
                  function hasContent() {
                      var arr = [];
                      arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
                      arr.push("判断结果为：");
                      arr.push(UE.getEditor('editor').hasContents());
                      alert(arr.join("\n"));
                  }
                  function setFocus() {
                      UE.getEditor('editor').focus();
                  }
                  function deleteEditor() {
                      disableBtn();
                      UE.getEditor('editor').destroy();
                  }
                  function disableBtn(str) {
                      var div = document.getElementById('btns');
                      var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
                      for (var i = 0, btn; btn = btns[i++];) {
                          if (btn.id == str) {
                              UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
                          } else {
                              btn.setAttribute("disabled", "true");
                          }
                      }
                  }
                  function enableBtn() {
                      var div = document.getElementById('btns');
                      var btns = UE.dom.domUtils.getElementsByTagName(div, "button");
                      for (var i = 0, btn; btn = btns[i++];) {
                          UE.dom.domUtils.removeAttributes(btn, ["disabled"]);
                      }
                  }

                  function getLocalData () {
                      alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
                  }

                  function clearLocalData () {
                      UE.getEditor('editor').execCommand( "clearlocaldata" );
                      alert("已清空草稿箱")
                  }
              </script>
              {/if}
            </td>
          </tr>
        </table>

        <!-- 其它信息 -->
        <table width="90%" id="mix-table" style="display:none" align="center">
          <!-- 商品重量 -->
          <tr>
            <td class="label">{$lang.lab_goods_weight}</td>
            <td><input type="text" name="goods_weight" value="{$goods.goods_weight_by_unit}" size="20" /> <select name="weight_unit">{html_options options=$unit_list selected=$weight_unit}</select></td>
          </tr>
          <!-- 商品重量end -->
          <!-- 库存警告数量 -->
          <tr>
            <td class="label">{$lang.lab_warn_number}</td>
            <td><input type="text" name="warn_number" value="{$goods.warn_number}" size="20" /></td>
          </tr>
          <!-- 库存警告数量end -->
          <!-- 加入推荐 -->
          <tr>
            <td class="label">{$lang.lab_intro}</td>
            <td><input type="checkbox" name="is_best" value="1" {if $goods.is_best}checked="checked"{/if} />{$lang.is_best} <input type="checkbox" name="is_new" value="1" {if $goods.is_new}checked="checked"{/if} />{$lang.is_new} <input type="checkbox" name="is_hot" value="1" {if $goods.is_hot}checked="checked"{/if} />{$lang.is_hot}</td>
          </tr>
          <!-- 加入推荐end -->
          <!-- 上架 -->
          <tr id="alone_sale_1">
            <td class="label" id="alone_sale_2">{$lang.lab_is_on_sale}</td>
            <td id="alone_sale_3"><input type="checkbox" name="is_on_sale" value="1" {if $goods.is_on_sale}checked="checked"{/if} /> {$lang.on_sale_desc}</td>
          </tr>
          <!-- 上架end -->
          <!-- 能作为普通商品销售 -->
          <tr>
            <td class="label">{$lang.lab_is_alone_sale}</td>
            <td><input type="checkbox" name="is_alone_sale" value="1" {if $goods.is_alone_sale}checked="checked"{/if} /> {$lang.alone_sale}</td>
          </tr>
          <!-- 能作为普通商品销售end -->
          <!-- 是否为免运费商品 -->
          <tr>
            <td class="label">{$lang.lab_is_free_shipping}</td>
            <td><input type="checkbox" name="is_shipping" value="1" {if $goods.is_shipping}checked="checked"{/if} /> {$lang.free_shipping}</td>
          </tr>
          <!-- 是否为免运费商品end -->
          <!-- 商品关键词 -->
          <tr>
            <td class="label">{$lang.lab_keywords}</td>
            <td><input type="text" name="keywords" value="{$goods.keywords|escape}" size="40" /> {$lang.notice_keywords}</td>
          </tr>
          <!-- 商品关键词end -->
          <!-- 商品简单描述 -->
          <tr>
            <td class="label">{$lang.lab_goods_brief}</td>
            <td><textarea name="goods_brief" cols="40" rows="3">{$goods.goods_brief|escape}</textarea></td>
          </tr>
          <!-- 商品简单描述end -->
          <!-- 合并关联列表页名称 -->
          <tr>
            <td class="label">合并关联列表页名称：</td>
            <td><textarea name="shopall_note" cols="40" rows="3">{$goods.shopall_note}</textarea><br /></td>
          </tr>
          <!-- 合并关联列表页名称end -->
          <!-- 最组合商品信息 -->
          <tr>
            <td class="label">最组合商品信息：</td>
            <td><textarea name="compose_note" cols="40" rows="3">{$goods.compose_note}</textarea><br /></td>
          </tr>
          <!-- 最组合商品信息end -->
          <!-- 商家备注 -->
          <tr>
            <td class="label">
            <a href="javascript:showNotice('noticeSellerNote');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a> {$lang.lab_seller_note} </td>
            <td><textarea name="seller_note" cols="40" rows="3">{$goods.seller_note}</textarea><br />
            <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeSellerNote">{$lang.notice_seller_note}</span></td>
          </tr>
          <!-- 商家备注 -->
        </table>
        <!-- 其它信息end -->

        <!-- 商品属性 -->
        {if $goods_type_list}
        <table width="100%" id="properties-table"  align="center" style="display:none">
          <tr>
              <td class="label"><a href="javascript:showNotice('noticeGoodsType');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>{$lang.lab_goods_type}</td>
              <td width="300">
                <select name="goods_type" onchange="getAttrList({$goods.goods_id})">
                  <option value="0">{$lang.sel_goods_type}</option>
                  {$goods_type_list}
                </select><br />
              <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsType">{$lang.notice_goods_type}</span></td>


              <td class="label" style="text-align:left; width: 10%;" ><a href="javascript:showNotice('noticeGoodsType');" title="{$lang.form_notice}"><img src="images/notice.gif" width="16" height="16" border="0" alt="{$lang.form_notice}"></a>服务区域</td>
              <td>
                <select name="goods_area" onchange="getAreaList({$goods.goods_id})">
                  <option value="0">{$lang.sel_goods_type}</option>
                  {$area_list}

                </select><br />

              <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeGoodsType">请选择对应区域修改</span></td>



          </tr>
          <tr>
            <td id="tbody-goodsAttr" colspan="4" style="padding:0">{$goods_attr_html}</td>
          </tr>
        </table>

        {/if}

        <!-- 商品相册 -->
        <table width="90%" id="gallery-table" style="display:none" align="center">
          <!-- 相册列表 -->
          <tr>
            <td>
              {foreach from=$img_list item=img key=i}
              <div id="gallery_{$img.img_id}" style="float:left; text-align:center; border: 1px solid #DADADA; margin: 4px; padding:2px;">
                <a href="javascript:;" onclick="if (confirm('{$lang.drop_img_confirm}')) dropImg('{$img.img_id}')">[-]</a><br />
                <a href="goods.php?act=show_image&img_url={$img.img_url}" target="_blank">
                <img src="../{if $img.thumb_url}{$img.thumb_url}{else}{$img.img_url}{/if}" {if $thumb_width neq 0}width="{$thumb_width}"{/if} {if $thumb_height neq 0}height="{$thumb_height}"{/if} border="0" />
                </a><br />
                <input type="text" value="{$img.img_desc|escape}" size="15" name="old_img_desc[{$img.img_id}]" />
              </div>
              {/foreach}
            </td>
          </tr>
          <tr><td>&nbsp;</td></tr>
          <!-- 上传图片 -->
          <tr>
            <td>
              <a href="javascript:;" onclick="addImg(this)">[+]</a>
              {$lang.img_desc} <input type="text" name="img_desc[]" size="20" />
              {$lang.img_url} <input type="file" name="img_url[]" />
              <input type="text" size="40" value="{$lang.img_file}" style="color:#aaa;" onfocus="if (this.value == '{$lang.img_file}'){this.value='http://';this.style.color='#000';}" name="img_file[]"/>
            </td>
          </tr>
        </table>
        <!-- 商品相册end -->

        <!-- 关联商品 -->
        <table width="90%" id="linkgoods-table" style="display:none" align="center">
          <!-- 搜索 -->
          <tr>
            <td colspan="3">
              <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
              <select name="cat_id1"><option value="0">{$lang.all_category}</option>{$cat_list}</select>
              <select name="brand_id1"><option value="0">{$lang.all_brand}</option>{html_options options=$brand_list}</select>
              <input type="text" name="keyword1" />
              <input type="button" value="{$lang.button_search}"  class="button"
                onclick="searchGoods(sz1, 'cat_id1','brand_id1','keyword1')" />
            </td>
          </tr>
          <!-- 商品选择区 -->
          <tr>
            <th>{$lang.all_goods}</th>
            <th>{$lang.handler}</th>
            <th>{$lang.link_goods}</th>
          </tr>
          <tr>
            <td width="42%">
              <select name="source_select1" size="20" style="width:100%" ondblclick="sz1.addItem(false, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" multiple="true">
              </select>
            </td>
            <td align="center">
              <p><input type="checkbox" id="is_all_link" name="is_all_link" value="1" >全面关联</p>
              <p><input name="is_single" type="radio" value="1" checked="checked" />{$lang.single}<br /><input name="is_single" type="radio" value="0" />{$lang.double}</p>
              <p><input type="button" value=">>" onclick="sz1.addItem(true, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" class="button" /></p>
              <p><input type="button" value=">" onclick="sz1.addItem(false, 'add_link_goods', goodsId, this.form.elements['is_single'][0].checked)" class="button" /></p>
              <p><input type="button" value="<" onclick="sz1.dropItem(false, 'drop_link_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>
              <p><input type="button" value="<<" onclick="sz1.dropItem(true, 'drop_link_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>
            </td>
            <td width="42%">
              <select name="target_select1" size="20" style="width:100%" multiple ondblclick="sz1.dropItem(false, 'drop_link_goods', goodsId, elements['is_single'][0].checked)">
                {foreach from=$link_goods_list item=link_goods}
                <option value="{$link_goods.goods_id}">{$link_goods.goods_name}</option>
                {/foreach}
              </select>
            </td>
          </tr>
        </table>

        <!-- 配件 -->
        <table width="90%" id="groupgoods-table" style="display:none" align="center">
          <!-- 搜索 -->
          <tr>
            <td colspan="3">
              <img src="images/icon_search.gif" width="26" height="22" border="0" alt="SEARCH" />
              <select name="cat_id2"><option value="0">{$lang.all_category}</option>{$cat_list}</select>
              <select name="brand_id2"><option value="0">{$lang.all_brand}</option>{html_options options=$brand_list}</select>
              <input type="text" name="keyword2" />
              <input type="button" value="{$lang.button_search}" onclick="searchGoods(sz2, 'cat_id2', 'brand_id2', 'keyword2')" class="button" />
            </td>
          </tr>
          <!-- 商品选择区 -->
          <tr>
            <th>{$lang.all_goods}</th>
            <th>{$lang.handler}</th>
            <th>{$lang.group_goods}</th>
          </tr>
          <tr>
            <td width="42%">
              <select name="source_select2" size="20" style="width:100%" onchange="sz2.priceObj.value = this.options[this.selectedIndex].id" ondblclick="sz2.addItem(false, 'add_group_goods', goodsId, this.form.elements['price2'].value)">
              </select>
            </td>
            <td align="center">
              <p>{$lang.price}<br /><input name="price2" type="text" size="6" /></p>
              <p><input type="button" value=">" onclick="sz2.addItem(false, 'add_group_goods', goodsId, this.form.elements['price2'].value)" class="button" /></p>
              <p><input type="button" value="<" onclick="sz2.dropItem(false, 'drop_group_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>
              <p><input type="button" value="<<" onclick="sz2.dropItem(true, 'drop_group_goods', goodsId, elements['is_single'][0].checked)" class="button" /></p>
            </td>
            <td width="42%">
              <select name="target_select2" size="20" style="width:100%" multiple ondblclick="sz2.dropItem(false, 'drop_group_goods', goodsId, elements['is_single'][0].checked)">
                {foreach from=$group_goods_list item=group_goods}
                <option value="{$group_goods.goods_id}">{$group_goods.goods_name}</option>
                {/foreach}
              </select>
            </td>
          </tr>
        </table>
        <!-- 配件end -->
        <!-- 服务区库存 -->
        <table width="90%" id="serviceprice-table"  align="center" style="display:none">
          <!-- {foreach from=$price_list item=item} -->
          <tr>
            <td class="label">
              {$item.area_name}：
            </td>
            <td>
              <input type="hidden" name="area_id[]" value="{$item.area_id}">
              <input type="hidden" name="id[]" value="{$item.id}">
              现有库存
              <input type="text" name="goods_number[]" value="{$item.goods_number}" size="8" maxlength="10">
              进货价
              <input type="text" name="goods_xprice[]" value="{$item.goods_xprice}" size="8" maxlength="10">
            </td>
          </tr>
          <!-- {/foreach} -->
        </table>
        <!-- 服务区库存END -->

        <div class="button-div">
          <input type="hidden" name="goods_id" value="{$goods.goods_id}" />
          <input type="button" value="{$lang.button_submit}" class="button" onclick="validate('{$goods.goods_id}')" />
          <input type="reset" value="{$lang.button_reset}" class="button" />
        </div>
        <input type="hidden" name="act" value="{$form_act}" />
      </form>
    </div>
</div>
<!-- end goods form -->
{insert_scripts files="validator.js,tab.js"}

<script language="JavaScript">
  var goodsId = '{$goods.goods_id}';
  var elements = document.forms['theForm'].elements;
  var sz1 = new SelectZone(1, elements['source_select1'], elements['target_select1']);
  var sz2 = new SelectZone(2, elements['source_select2'], elements['target_select2'], elements['price2']);
  var sz3 = new SelectZone(1, elements['source_select3'], elements['target_select3']);
  var marketPriceRate = {$cfg.market_price_rate|default:1};
  var integralPercent = {$cfg.integral_percent|default:0};

  {literal}
  onload = function()
  {
      handlePromote(document.forms['theForm'].elements['is_promote'].checked);

      if (document.forms['theForm'].elements['auto_thumb'])
      {
          handleAutoThumb(document.forms['theForm'].elements['auto_thumb'].checked);
      }

      // 妫€鏌ユ柊璁㈠崟
      startCheckOrder();
      {/literal}
      {foreach from=$user_rank_list item=item}
      set_price_note({$item.rank_id});
      {/foreach}
      {literal}
      document.forms['theForm'].reset();
  }

  function validate(goods_id)
  {
      var validator = new Validator('theForm');
      var goods_sku  = document.forms['theForm'].elements['goods_sku'].value;
      //获取商品属性SKU判断是否重复
      var ls =document.getElementsByName('attr_sku_list[]');
      var attr_sku_list = new Array();
      for( i = 0; i < ls.length; i++) {
           attr_sku_list[i]=ls[i].value;
      }
      var attr_sku=attr_sku_list.sort();
       for(var i=0;i<attr_sku.length;i++){
       if (attr_sku[i]==attr_sku[i+1]){
        alert("数组重复内容："+attr_sku[i]);
        return false;
       }

      }
      
      validator.required('goods_name', '商品名称不能为空');
      if (document.forms['theForm'].elements['cat_id'].value == 0)
      {
          validator.addErrorMsg(goods_cat_not_null);
      }
      validator.isNumber('market_price', market_price_not_number, false);
      var callback = function(res)
      {
      if (res.error > 0)
      {
        alert("{$lang.goods_sn_exists}");
      }
      else
      {
         if(validator.passed())
         {
         document.forms['theForm'].submit();
         }
      }
      }
    Ajax.call('goods.php?is_ajax=1&act=check_goods_sku', "goods_sku=" + goods_sku + "&goods_id=" + goods_id, callback, "GET", "JSON");
}

  /**
   * 动态获取属性列表
   */
  function getAttrList(goodsId)
  {
      var selGoodsType = document.forms['theForm'].elements['goods_type'];

      if (selGoodsType != undefined)
      {
          var goodsType = selGoodsType.options[selGoodsType.selectedIndex].value;

          Ajax.call('goods.php?is_ajax=1&act=get_attr', 'goods_id=' + goodsId + "&goods_type=" + goodsType, setAttrList, "GET", "JSON");
      }
  }
  /**
   * 动态获取属性列表
   */
  function getAreaList(goodsId)
  {
      var selGoodsType = document.forms['theForm'].elements['goods_area'];

      if (selGoodsType != undefined)
      {
          var area_id = selGoodsType.options[selGoodsType.selectedIndex].value;

          Ajax.call('goods.php?is_ajax=1&act=get_attr', 'goods_id=' + goodsId + "&area_id=" + area_id, setAttrList, "GET", "JSON");
      }
  }

  function setAttrList(result, text_result)
  {
    document.getElementById('tbody-goodsAttr').innerHTML = result.content;
  }

  /**
   * 鎸夋瘮渚嬭?绠椾环鏍
   * @param   string  inputName   杈撳叆妗嗗悕绉
   * @param   float   rate        姣斾緥
   * @param   string  priceName   浠锋牸杈撳叆妗嗗悕绉帮紙濡傛灉娌℃湁锛屽彇shop_price锛
   */
  function computePrice(inputName, rate, priceName)
  {
      var shopPrice = priceName == undefined ? document.forms['theForm'].elements['shop_price'].value : document.forms['theForm'].elements[priceName].value;
      shopPrice = Utils.trim(shopPrice) != '' ? parseFloat(shopPrice)* rate : 0;
      if(inputName == 'integral')
      {
          shopPrice = parseInt(shopPrice);
      }
      shopPrice += "";

      n = shopPrice.lastIndexOf(".");
      if (n > -1)
      {
          shopPrice = shopPrice.substr(0, n + 3);
      }

      if (document.forms['theForm'].elements[inputName] != undefined)
      {
          document.forms['theForm'].elements[inputName].value = shopPrice;
      }
      else
      {
          document.getElementById(inputName).value = shopPrice;
      }
  }


    {literal}

  /**
   * 添加属性
   */
  function addSpec(obj)
  {
      var src   = obj.parentNode.parentNode;
      var idx   = rowindex(src);
      var tbl   = document.getElementById('attrTable');
      var row   = tbl.insertRow(idx + 1);
      var cell1 = row.insertCell(-1);
      var cell2 = row.insertCell(-1);
      var regx  = /<a([^>]+)<\/a>/i;

      cell1.className = 'label';
      cell1.innerHTML = src.childNodes[0].innerHTML.replace(/(.*)(addSpec)(.*)(\[)(\+)/i, "$1removeSpec$3$4-");
      cell2.innerHTML = src.childNodes[1].innerHTML.replace(/readOnly([^\s|>]*)/i, '');
  }

  /**
   * 移除属性
   */
  function removeSpec(obj)
  {
      var row = rowindex(obj.parentNode.parentNode);
      var tbl = document.getElementById('attrTable');

      tbl.deleteRow(row);
  }

  /**
   * 处理属性
   */
  function handleSpec()
  {
      var elementCount = document.forms['theForm'].elements.length;
      for (var i = 0; i < elementCount; i++)
      {
          var element = document.forms['theForm'].elements[i];
          if (element.id.substr(0, 5) == 'spec_')
          {
              var optCount = element.options.length;
              var value = new Array(optCount);
              for (var j = 0; j < optCount; j++)
              {
                  value[j] = element.options[j].value;
              }

              var hiddenSpec = document.getElementById('hidden_' + element.id);
              hiddenSpec.value = value.join(String.fromCharCode(13)); // 鐢ㄥ洖杞﹂敭闅斿紑姣忎釜瑙勬牸
          }
      }
      return true;
  }
  // 促销活动
  function handlePromote(checked)
  {
      document.forms['theForm'].elements['promote_price'].disabled = !checked;
      document.forms['theForm'].elements['selbtn1'].disabled = !checked;
      document.forms['theForm'].elements['selbtn2'].disabled = !checked;
  }

  // 自动生成商品缩略图
  function handleAutoThumb(checked)
  {
      document.forms['theForm'].elements['goods_thumb'].disabled = checked;
      document.forms['theForm'].elements['goods_thumb_url'].disabled = checked;
  }

  /**
   * 快速添加品牌
   */
  function rapidBrandAdd(conObj)
  {
      var brand_div = document.getElementById("brand_add");

      if(brand_div.style.display != '')
      {
          var brand =document.forms['theForm'].elements['addedBrandName'];
          brand.value = '';
          brand_div.style.display = '';
      }
  }
  // 隐藏品牌div
  function hideBrandDiv()
  {
      var brand_add_div = document.getElementById("brand_add");
      if(brand_add_div.style.display != 'none')
      {
          brand_add_div.style.display = 'none';
      }
  }

  // 跳转至品牌管理页面
  function goBrandPage()
  {
      if(confirm(go_brand_page))
      {
          window.location.href='brand.php?act=add';
      }
      else
      {
          return;
      }
  }

  // 快速添加分类
  function rapidCatAdd()
  {
      var cat_div = document.getElementById("category_add");

      if(cat_div.style.display != '')
      {
          var cat =document.forms['theForm'].elements['addedCategoryName'];
          cat.value = '';
          cat_div.style.display = '';
      }
  }

  // 添加品牌
  function addBrand()
  {
      var brand = document.forms['theForm'].elements['addedBrandName'];
      if(brand.value.replace(/^\s+|\s+$/g, '') == '')
      {
          alert(brand_cat_not_null);
          return;
      }

      var params = 'brand=' + brand.value;
      Ajax.call('brand.php?is_ajax=1&act=add_brand', params, addBrandResponse, 'GET', 'JSON');
  }

  // 添加品牌响应函数
  function addBrandResponse(result)
  {
      if (result.error == '1' && result.message != '')
      {
          alert(result.message);
          return;
      }

      var brand_div = document.getElementById("brand_add");
      brand_div.style.display = 'none';

      var response = result.content;

      var selCat = document.forms['theForm'].elements['brand_id'];
      var opt = document.createElement("OPTION");
      opt.value = response.id;
      opt.selected = true;
      opt.text = response.brand;

      if (Browser.isIE)
      {
          selCat.add(opt);
      }
      else
      {
          selCat.appendChild(opt);
      }

      return;
  }

  // 添加分类
  function addCategory()
  {
      var parent_id = document.forms['theForm'].elements['cat_id'];
      var cat = document.forms['theForm'].elements['addedCategoryName'];
      if(cat.value.replace(/^\s+|\s+$/g, '') == '')
      {
          alert(category_cat_not_null);
          return;
      }

      var params = 'parent_id=' + parent_id.value;
      params += '&cat=' + cat.value;
      Ajax.call('category.php?is_ajax=1&act=add_category', params, addCatResponse, 'GET', 'JSON');
  }

  // 隐藏分类div
  function hideCatDiv()
  {
      var category_add_div = document.getElementById("category_add");
      if(category_add_div.style.display != null)
      {
          category_add_div.style.display = 'none';
      }
  }

  // 添加分类响应
  function addCatResponse(result)
  {
      if (result.error == '1' && result.message != '')
      {
          alert(result.message);
          return;
      }

      var category_add_div = document.getElementById("category_add");
      category_add_div.style.display = 'none';

      var response = result.content;

      var selCat = document.forms['theForm'].elements['cat_id'];
      var opt = document.createElement("OPTION");
      opt.value = response.id;
      opt.selected = true;
      opt.innerHTML = response.cat;

      //鑾峰彇瀛愬垎绫荤殑绌烘牸鏁
      var str = selCat.options[selCat.selectedIndex].text;
      var temp = str.replace(/^\s+/g, '');
      var lengOfSpace = str.length - temp.length;
      if(response.parent_id != 0)
      {
          lengOfSpace += 4;
      }
      for (i = 0; i < lengOfSpace; i++)
      {
          opt.innerHTML = '&nbsp;' + opt.innerHTML;
      }

      for (i = 0; i < selCat.length; i++)
      {
          if(selCat.options[i].value == response.parent_id)
          {
              if(i == selCat.length)
              {
                  if (Browser.isIE)
                  {
                      selCat.add(opt);
                  }
                  else
                  {
                      selCat.appendChild(opt);
                  }
              }
              else
              {
                  selCat.insertBefore(opt, selCat.options[i + 1]);
              }
              //opt.selected = true;
              break;
          }

      }

      return;
  }

  // 跳转到添加分类页面
    function goCatPage()
    {
        if(confirm(go_category_page))
        {
            window.location.href='category.php?act=add';
        }
        else
        {
            return;
        }
    }


  /**
   * 移除分类
   */
  function removeCat()
  {
      if(!document.forms['theForm'].elements['parent_cat'] || !document.forms['theForm'].elements['new_cat_name'])
      {
          return;
      }

      var cat_select = document.forms['theForm'].elements['parent_cat'];
      var cat = document.forms['theForm'].elements['new_cat_name'];

      cat.parentNode.removeChild(cat);
      cat_select.parentNode.removeChild(cat_select);
  }

  /**
   * 移除品牌
   */
  function removeBrand()
  {
      if (!document.forms['theForm'].elements['new_brand_name'])
      {
          return;
      }

      var brand = document.theForm.new_brand_name;
      brand.parentNode.removeChild(brand);
  }

  /**
   * 增加扩展分类
   */
  function addOtherCat(conObj)
  {
      var sel = document.createElement("SELECT");
      var selCat = document.forms['theForm'].elements['cat_id'];

      for (i = 0; i < selCat.length; i++)
      {
          var opt = document.createElement("OPTION");
          opt.text = selCat.options[i].text;
          opt.value = selCat.options[i].value;
          opt.setAttribute('parent-id',selCat.options[i].getAttribute('parent-id'));
          opt.setAttribute('level',selCat.options[i].getAttribute('level'));
          if (selCat.options[i].getAttribute('parent-id') != 0) {
              opt.style.display = 'none';
          }
          if (Browser.isIE)
          {
              sel.add(opt);
          }
          else
          {
              sel.appendChild(opt);
          }
      }
      conObj.appendChild(sel);
      sel.name = "other_cat[]";
      sel.onChange = function() {checkIsLeaf(this);};
  }

  /* 搜索商品 */
  function searchGoods(szObject, catId, brandId, keyword)
  {
      var filters = new Object;

      filters.cat_id = elements[catId].value;
      filters.brand_id = elements[brandId].value;
      filters.keyword = Utils.trim(elements[keyword].value);
      filters.exclude = document.forms['theForm'].elements['goods_id'].value;

      szObject.loadOptions('get_goods_list', filters);
  }


  /**
   * 添加上传图片
   */
  function addImg(obj)
  {
      var src  = obj.parentNode.parentNode;
      var idx  = rowindex(src);
      var tbl  = document.getElementById('gallery-table');
      var row  = tbl.insertRow(idx + 1);
      var cell = row.insertCell(-1);
      cell.innerHTML = src.cells[0].innerHTML.replace(/(.*)(addImg)(.*)(\[)(\+)/i, "$1removeImg$3$4-");
  }

  /**
   * 删除移除图片
   */
  function removeImg(obj)
  {
      var row = rowindex(obj.parentNode.parentNode);
      var tbl = document.getElementById('gallery-table');

      tbl.deleteRow(row);
  }

  /**
   * 停止上传
   */
  function dropImg(imgId)
  {
    Ajax.call('goods.php?is_ajax=1&act=drop_image', "img_id="+imgId, dropImgResponse, "GET", "JSON");
  }

  function dropImgResponse(result)
  {
      if (result.error == 0)
      {
          document.getElementById('gallery_' + result.content).style.display = 'none';
      }
  }

  /**
   * 格式化市场价为整形
   */
  function integral_market_price()
  {
    document.forms['theForm'].elements['market_price'].value = parseInt(document.forms['theForm'].elements['market_price'].value);
  }

   /**
   * 格式化积分数字为整形
   */
  function parseint_integral()
  {
    document.forms['theForm'].elements['integral'].value = parseInt(document.forms['theForm'].elements['integral'].value);
  }


  /**
  * 检查商品编码是否重复
  */
  function checkGoodsSku(goods_sku, goods_id)
  {
    if (goods_sku == '')
    {
        document.getElementById('goods_sku_notice').innerHTML = "";
        return;
    }

    var callback = function(res)
    {
      if (res.error > 0)
      {
        document.getElementById('goods_sku_notice').innerHTML = res.message;
        document.getElementById('goods_sku_notice').style.color = "red";
      }
      else
      {
        document.getElementById('goods_sku_notice').innerHTML = "";
      }
    }
    Ajax.call('goods.php?is_ajax=1&act=check_goods_sku', "goods_sku=" + goods_sku + "&goods_id=" + goods_id, callback, "GET", "JSON");
  }

  /**
  * 检查商品编码是否重复
  */
  function checkGoodsCode(code)
  {
    if (!code)
    {
        document.getElementById('goods_code_notice').innerHTML = "";
        return;
    }

    var callback2 = function(res)
    {
      if (res.error > 0)
      {
        document.getElementById('goods_code_notice').innerHTML = res.message;
        document.getElementById('goods_code_notice').style.color = "red";
      }
      else
      {
        document.getElementById('goods_code_notice').innerHTML = "";
      }
    }
    Ajax.call('goods.php?is_ajax=1&act=check_goods_code', "code=" + code, callback2, "GET", "JSON");
  }

$('body').on('change', 'select[name="cat_id"], select[name="other_cat[]"]', function () {
    var id = $(this).val();
    var l = $(this).find("option:selected").attr('level');
    $.each($(this).find('option'), function(i, v){
        if ($(this).attr('level') > l && $(this).attr('parent-id') != id) {
            $(this).hide();
        } else if ($(this).attr('parent-id') == id) {
            $(this).show();
        }
    });
    $('select[parent-id="'+id+'"]').show().siblings().hide();
});


  {/literal}
</script>
{include file="pagefooter.htm"}
